package com.kaola.dao.impl;

import java.util.HashSet;
import java.util.List;
import java.util.Set;

import org.springframework.orm.hibernate3.HibernateTemplate;

import com.kaola.dao.ProductDAO;
import com.kaola.pojo.Category;
import com.kaola.pojo.Product;
import com.kaola.pojo.User;

public class ProductDAOImpl extends HibernateTemplate implements ProductDAO {

	public void add(Product product) {
		save(product);
	}

	public List<Product> list(Category category) {
		return find("from Product p where p.category=?", category);
	}
	
	public Product get(int id) {
		return get(Product.class, id);
	}
	
	public void modify(Product product) {
		update(product);
	}

	public void delete(int id) {
		delete(get(id));
	}
}
